package file;

import java.io.File;
/*
* public boolean delete()
*   如果删除的是文件夹,那么文件夹必须为空,否则不能删除
*   如果删除成功返回true,删除失败返回false
*   该删除方法慎用,因为删除的文件或文件夹不走回收站
*
* */
public class FileDemo05 {
    public static void main(String[] args) {
        //method01();
        //指定的文件在硬盘不存在,删除失败
        File file01 = new File("day21-file/3.txt");
        System.out.println(file01.delete());//false

      /*  File file02 = new File("day21-file/ghk");
        System.out.println(file02.delete());//false*/

        File file03 = new File("day21-file/ghk/lm");
        System.out.println(file03.delete());//true

        File file04 = new File("day21-file/ghk");
        System.out.println(file04.delete());//true




    }

    private static void method01() {
        File file = new File("day21-file/1.txt");
        System.out.println(file.delete());//true
    }
}
